<div class="page-header">
	<h2>Ajouter / Editer une actualité</h2>
</div>
<ol class="breadcrumb">
  <li><a href="<?php echo Router::url('admin'); ?>">Accueil</a></li>
  <li><a href="<?php echo Router::url('admin/actus'); ?>">Gestion des actualités</a></li>
  <li class="active">Ajouter, Editer une actualité</li>
</ol>

<form class="form-horizontal" action="<?php echo Router::url('admin/actus/edit/'.$id); ?>" method="post">
	<div class="form-group">
	<div class="col-lg-10">
	<?php echo $this->Form->input('titre','Titre',array('type' => 'text', 'required' => '""')); ?>
	</div>
	<div class="col-lg-10">
	<?php echo $this->Form->input('slug','Adresse URL',array('type' => 'text', 'required' => '""')); ?>
</div>
	<?php echo $this->Form->input('id','hidden') ; ?>
	<div class="col-lg-10">
	<?php echo $this->Form->input('description','Description',array('type' => 'textarea', 'class' => 'form-control', 'class' => 'specifique', 'rows' => 5)); ?>
</div>
<div class="col-lg-10">
	<?php echo $this->Form->input('online','En ligne',array('type' => 'checkbox')); ?>
</div>
</div>
	<div class"actions">
		<a class="btn btn-default active" role="button" href="<?php echo Router::url('admin/actus/index'); ?>">Annuler</a>
		<input type="submit" class="btn btn-primary" value="Envoyer">
	</div>
</form>

<script src="<?php echo Router::webroot('js/tinymce/tinymce.min.js') ;?>"></script>

  <script type="text/javascript">
tinymce.init({
	selector: "textarea.specifique",
	language : 'fr_FR',
	menubar : false,
	plugins: ["link", "image"],
	relative_urls : false,
	toolbar: [
	"undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | link unlink image"],
	file_browser_callback : fileBrowser
}); 

function fileBrowser(field_name, url, type, win){
        if(type=='file'){
          var explorer = '<?php echo Router::url('admin/actus/tinymce'); ?>';
        }else{
          var explorer = '<?php echo Router::url('admin/medias/index/'.$id); ?>';
        }
 
        tinyMCE.activeEditor.windowManager.open({
            file : explorer,
            title : "Galerie d'images",
            width : 600,
            height : 400,
            resizable : 'yes',
        },{
            window : win,
            input : field_name
        });
        window.inputSrc = field_name
        return false;
    }
</script>
